package com.gis507.guolv_shijian;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @author leon
 * @ClassName TimeMapper.java
 * @createTime 2021年12月26日 19:15:00
 */
public class TimeMapper extends Mapper<LongWritable, Text, NullWritable, Text> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String comments = value.toString();
        String[] comment = comments.split(",");
        double lon = Double.parseDouble(comment[11]);
        double lat = Double.parseDouble(comment[12]);
        if (lon > 116.5 && lon < 124 && lat > 36 && lat < 42){
            context.write(NullWritable.get(), value);
        }
    }
}
